JBoss Community Archive (Read Only)

GateIn WCM

6. Configuration reference

GateIn WCM is deployed as a web application using wcm.war artifact.

GateIn WCM is a Java EE application, so it needs JBoss AS to be deployed.

Storage requeriments are:

This chapter will describe configuration aspects introduced earlier in 1. Getting Started.

6.1 Datasources and persistence unit

GateIn WCM uses EJB3 entities as technology to access backend.
It uses standard javax.persistence.* classes configured via persistence.xml file.

Datasource

By default, jndi-name for wcm datasource should be "java:jboss/datasources/wcmDS" as described in the following example:

standalone.xml
[...]
 <datasource jndi-name="java:jboss/datasources/wcmDS" pool-name="wcmDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:h2:file:${jboss.server.data.dir}/wcm/db/wcm_database;DB_CLOSE_DELAY=-1;AUTO_SERVER=TRUE</connection-url>
    <driver>h2</driver>
    <security>
        <user-name>sa</user-name>
        <password>sa</password>
    </security>
</datasource>
[...]

But, this name can be changed modifying expected datasource in the persistence.xml file defined under

wcm.war/WEB-INF/classes/META-INF/persistence.xml

GateIn WCM has been developed against H2 database included in GateIn / JBoss Portal for demo porpuses.

There is not specific code related to database as all org.gatein.wcm.domain.* classes uses EJB3 entities to access backend, so other databases should work without issues.

Package org.gatein.wcm.domain contains main ORM mapping annotations, all annotations used are standard and supported in major databases.

Persistence unit

Persistence unit configuration defines datasource name and cache configuration.

persistence.xml
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="wcm">
        <jta-data-source>java:jboss/datasources/wcmDS</jta-data-source>
        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.cache.use_second_level_cache" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

GateIn WCM has an extensive use of second level cache.
Ratio read / per write operations can be very high, so for performance reason, cache helps to not impact on database access for mostly reading operations.

Also cache configuration is managed by JBoss AS instead to be managed by application.

Cache configuration notes

JBoss AS uses Infinispan as cache subsystem.

Cache configuration for EJB3 entities are defined in the following fragment:

standalone.xml
[...]
        <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">
            <cache-container name="hibernate" default-cache="local-query">
                <local-cache name="entity">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <local-cache name="local-query">
                    <transaction mode="NONE"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <local-cache name="timestamps">
                    <transaction mode="NONE"/>
                    <eviction strategy="NONE"/>
                </local-cache>
            </cache-container>
        </subsystem>
[...]

6.2 wcm.properties configuration file

GateIn WCM also needs a wcm.properties file placed in JBoss AS configuration folder with the following options:

wcm.properties
# This group define which users can access to the LW WCM editor application.
# All users that belongs to this group have grant to access LW WCM Editor.
# Users with membership MANAGER (@see Wcm.MANAGER) also have administrator role in LW WCM editor.
wcm.groups.wcm=/wcm

# Users with membership MANAGER in @see Wcm.WCM group have administrator role in LW WCM editor.
wcm.groups.manager=manager

# If user has not valid group we assign a default group
wcm.groups.lost=/wcm/lost

# Defines system property name where to read the Upload's folder
wcm.uploads.folder=${jboss.server.data.dir}/wcm/uploads

# Defines the buffer's length for uploads operations (in bytes).
wcm.uploads.length_buffer=5242880

# Defines the max file size for Uploads.
wcm.uploads.max_file_size=5242880

# Defines properties for Client's browser cache.
# HTTP/1.1 Cache-Control parameters
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3
wcm.uploads.cache.max-age=300

# Defines number of items to show in WCM Editor portlet
wcm.views.max_per_page=3

# Defines suffix variables for dynamic content navigation inside WCM Content portlet
wcm.parameters.post=post
wcm.parameters.category=cat
wcm.parameters.id=id
wcm.parametes.name=name

# Defines max minutes a lock is valid
wcm.timeout.locks=20

# Defines constant for debug mode.
# Not used in current version, prepared for future.
wcm.debug=false

6.3 Clustering configuration notes

GateIn WCM can be deployed in a clustering environment as well as any Java EE application.

There are three aspects to take into consideration:

  • Database should be shared accross JBoss AS nodes.

  • Filesystem used should be shared accross JBoss AS nodes.

  • Infinispan used for 2nd level cache of EJB3 entities should be configured in clustered/distributed mode instead of local to avoid non-sync data between database and cache.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:43:26 UTC, last content change 2014-02-25 11:17:16 UTC.